﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract OSKartica typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OSKarticaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<OSKarticaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.OSKartica _currentOSKartica = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxOSKarticaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxOSKarticaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxOSKarticaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOS property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOSDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Datum property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Kolicina property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKolicinaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDTipRetka property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDTipRetkaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOrgJed property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOrgJedDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOsoba property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOsobaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Napomena property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNapomenaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IDStatus property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDStatusDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NabVr property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNabVrDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Vrijednost property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxVrijednostDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Zbroj property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxZbrojDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ispravak property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIspravakDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the AmVrijednost property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxAmVrijednostDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the KnjizVrijednost property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKnjizVrijednostDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IDUserCreated property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDUserCreatedDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumZapisa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumZapisaDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Organizacija> _IDOrgJedList;
		
		/// <summary> 
		/// The list of selectable Organizacija
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Organizacija> IDOrgJedList
		{
			get {return this._IDOrgJedList;}
			set 
			{
				this._IDOrgJedList = value;
				this.uxIDOrgJedDataGridViewColumn.DataSource = null;
				this.uxIDOrgJedDataGridViewColumn.DataSource = this._IDOrgJedList;
			}
		}
		
		private bool _allowNewItemInIDOrgJedList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Organizacija
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOrgJedList
		{
			get { return _allowNewItemInIDOrgJedList;}
			set
			{
				this._allowNewItemInIDOrgJedList = value;
				this.uxIDOrgJedDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.OsnovnoSredstvo> _IDOSList;
		
		/// <summary> 
		/// The list of selectable OsnovnoSredstvo
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.OsnovnoSredstvo> IDOSList
		{
			get {return this._IDOSList;}
			set 
			{
				this._IDOSList = value;
				this.uxIDOSDataGridViewColumn.DataSource = null;
				this.uxIDOSDataGridViewColumn.DataSource = this._IDOSList;
			}
		}
		
		private bool _allowNewItemInIDOSList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of OsnovnoSredstvo
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOSList
		{
			get { return _allowNewItemInIDOSList;}
			set
			{
				this._allowNewItemInIDOSList = value;
				this.uxIDOSDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Osoba> _IDOsobaList;
		
		/// <summary> 
		/// The list of selectable Osoba
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Osoba> IDOsobaList
		{
			get {return this._IDOsobaList;}
			set 
			{
				this._IDOsobaList = value;
				this.uxIDOsobaDataGridViewColumn.DataSource = null;
				this.uxIDOsobaDataGridViewColumn.DataSource = this._IDOsobaList;
			}
		}
		
		private bool _allowNewItemInIDOsobaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Osoba
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOsobaList
		{
			get { return _allowNewItemInIDOsobaList;}
			set
			{
				this._allowNewItemInIDOsobaList = value;
				this.uxIDOsobaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.OSTipRetka> _IDTipRetkaList;
		
		/// <summary> 
		/// The list of selectable OSTipRetka
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.OSTipRetka> IDTipRetkaList
		{
			get {return this._IDTipRetkaList;}
			set 
			{
				this._IDTipRetkaList = value;
				this.uxIDTipRetkaDataGridViewColumn.DataSource = null;
				this.uxIDTipRetkaDataGridViewColumn.DataSource = this._IDTipRetkaList;
			}
		}
		
		private bool _allowNewItemInIDTipRetkaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of OSTipRetka
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDTipRetkaList
		{
			get { return _allowNewItemInIDTipRetkaList;}
			set
			{
				this._allowNewItemInIDTipRetkaList = value;
				this.uxIDTipRetkaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.OSKartica> _OSKarticaList;
				
		/// <summary> 
		/// The list of OSKartica to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.OSKartica> OSKarticaList
		{
			get {return this._OSKarticaList;}
			set
			{
				this._OSKarticaList = value;
				this.uxOSKarticaBindingSource.DataSource = null;
				this.uxOSKarticaBindingSource.DataSource = value;
				this.uxOSKarticaDataGridView.DataSource = null;
				this.uxOSKarticaDataGridView.DataSource = this.uxOSKarticaBindingSource;				
				//this.uxOSKarticaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxOSKarticaBindingSource_ListChanged);
				this.uxOSKarticaBindingSource.CurrentItemChanged += new System.EventHandler(OnOSKarticaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnOSKarticaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentOSKartica = uxOSKarticaBindingSource.Current as Entities.OSKartica;
			
			if (_currentOSKartica != null)
			{
				_currentOSKartica.Validate();
			}
			//_OSKartica.Validate();
			OnCurrentEntityChanged();
		}

		//void uxOSKarticaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.OSKartica"/> instance.
		/// </summary>
		public Entities.OSKartica SelectedOSKartica
		{
			get {return this._currentOSKartica;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxOSKarticaDataGridView.VirtualMode;}
			set
			{
				this.uxOSKarticaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxOSKarticaDataGridView.AllowUserToAddRows;}
			set {this.uxOSKarticaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxOSKarticaDataGridView.AllowUserToDeleteRows;}
			set {this.uxOSKarticaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxOSKarticaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxOSKarticaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="OSKarticaDataGridViewBase"/> class.
		/// </summary>
		public OSKarticaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxOSKarticaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxOSKarticaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxOSKarticaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDOSDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxDatumDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKolicinaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDTipRetkaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDOrgJedDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDOsobaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxNapomenaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDStatusDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNabVrDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxVrijednostDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxZbrojDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIspravakDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxAmVrijednostDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKnjizVrijednostDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDUserCreatedDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumZapisaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDOrgJedBindingSource = new OrganizacijaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOrgJedBindingSource)).BeginInit();
			//this.uxIDOSBindingSource = new OsnovnoSredstvoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSBindingSource)).BeginInit();
			//this.uxIDOsobaBindingSource = new OsobaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOsobaBindingSource)).BeginInit();
			//this.uxIDTipRetkaBindingSource = new OSTipRetkaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDTipRetkaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSKarticaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSKarticaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSKarticaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxOSKarticaErrorProvider
			// 
			this.uxOSKarticaErrorProvider.ContainerControl = this;
			this.uxOSKarticaErrorProvider.DataSource = this.uxOSKarticaBindingSource;						
			// 
			// uxOSKarticaDataGridView
			// 
			this.uxOSKarticaDataGridView.AutoGenerateColumns = false;
			this.uxOSKarticaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxOSKarticaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxIDOSDataGridViewColumn,
		this.uxDatumDataGridViewColumn,
		this.uxKolicinaDataGridViewColumn,
		this.uxIDTipRetkaDataGridViewColumn,
		this.uxIDOrgJedDataGridViewColumn,
		this.uxIDOsobaDataGridViewColumn,
		this.uxNapomenaDataGridViewColumn,
		this.uxIDStatusDataGridViewColumn,
		this.uxNabVrDataGridViewColumn,
		this.uxVrijednostDataGridViewColumn,
		this.uxZbrojDataGridViewColumn,
		this.uxIspravakDataGridViewColumn,
		this.uxAmVrijednostDataGridViewColumn,
		this.uxKnjizVrijednostDataGridViewColumn,
		this.uxIDUserCreatedDataGridViewColumn,
		this.uxDatumZapisaDataGridViewColumn			});
			this.uxOSKarticaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxOSKarticaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxOSKarticaDataGridView.Name = "uxOSKarticaDataGridView";
			this.uxOSKarticaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxOSKarticaDataGridView.TabIndex = 0;	
			this.uxOSKarticaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxOSKarticaDataGridView.EnableHeadersVisualStyles = false;
			this.uxOSKarticaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnOSKarticaDataGridViewDataError);
			this.uxOSKarticaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOSKarticaDataGridViewCellValueNeeded);
			this.uxOSKarticaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOSKarticaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxIDOSDataGridViewColumn
			//
			this.uxIDOSDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOSDataGridViewColumn.DataPropertyName = "IDOS";
			this.uxIDOSDataGridViewColumn.HeaderText = "IDOS";
			this.uxIDOSDataGridViewColumn.Name = "uxIDOSDataGridViewColumn";
			this.uxIDOSDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOSDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOSDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumDataGridViewColumn
			//
			this.uxDatumDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumDataGridViewColumn.DataPropertyName = "Datum";
			this.uxDatumDataGridViewColumn.HeaderText = "Datum";
			this.uxDatumDataGridViewColumn.Name = "uxDatumDataGridViewColumn";
			this.uxDatumDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumDataGridViewColumn.ReadOnly = false;		
			//
			// uxKolicinaDataGridViewColumn
			//
			this.uxKolicinaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKolicinaDataGridViewColumn.DataPropertyName = "Kolicina";
			this.uxKolicinaDataGridViewColumn.HeaderText = "Kolicina";
			this.uxKolicinaDataGridViewColumn.Name = "uxKolicinaDataGridViewColumn";
			this.uxKolicinaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKolicinaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKolicinaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDTipRetkaDataGridViewColumn
			//
			this.uxIDTipRetkaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDTipRetkaDataGridViewColumn.DataPropertyName = "IDTipRetka";
			this.uxIDTipRetkaDataGridViewColumn.HeaderText = "IDTipRetka";
			this.uxIDTipRetkaDataGridViewColumn.Name = "uxIDTipRetkaDataGridViewColumn";
			this.uxIDTipRetkaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDTipRetkaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDTipRetkaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOrgJedDataGridViewColumn
			//
			this.uxIDOrgJedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOrgJedDataGridViewColumn.DataPropertyName = "IDOrgJed";
			this.uxIDOrgJedDataGridViewColumn.HeaderText = "IDOrgJed";
			this.uxIDOrgJedDataGridViewColumn.Name = "uxIDOrgJedDataGridViewColumn";
			this.uxIDOrgJedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOrgJedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOrgJedDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOsobaDataGridViewColumn
			//
			this.uxIDOsobaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOsobaDataGridViewColumn.DataPropertyName = "IDOsoba";
			this.uxIDOsobaDataGridViewColumn.HeaderText = "IDOsoba";
			this.uxIDOsobaDataGridViewColumn.Name = "uxIDOsobaDataGridViewColumn";
			this.uxIDOsobaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOsobaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOsobaDataGridViewColumn.ReadOnly = false;		
			//
			// uxNapomenaDataGridViewColumn
			//
			this.uxNapomenaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNapomenaDataGridViewColumn.DataPropertyName = "Napomena";
			this.uxNapomenaDataGridViewColumn.HeaderText = "Napomena";
			this.uxNapomenaDataGridViewColumn.Name = "uxNapomenaDataGridViewColumn";
			this.uxNapomenaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNapomenaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNapomenaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDStatusDataGridViewColumn
			//
			this.uxIDStatusDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDStatusDataGridViewColumn.DataPropertyName = "IDStatus";
			this.uxIDStatusDataGridViewColumn.HeaderText = "IDStatus";
			this.uxIDStatusDataGridViewColumn.Name = "uxIDStatusDataGridViewColumn";
			this.uxIDStatusDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDStatusDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDStatusDataGridViewColumn.ReadOnly = false;		
			//
			// uxNabVrDataGridViewColumn
			//
			this.uxNabVrDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNabVrDataGridViewColumn.DataPropertyName = "NabVr";
			this.uxNabVrDataGridViewColumn.HeaderText = "NabVr";
			this.uxNabVrDataGridViewColumn.Name = "uxNabVrDataGridViewColumn";
			this.uxNabVrDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNabVrDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNabVrDataGridViewColumn.ReadOnly = false;		
			//
			// uxVrijednostDataGridViewColumn
			//
			this.uxVrijednostDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxVrijednostDataGridViewColumn.DataPropertyName = "Vrijednost";
			this.uxVrijednostDataGridViewColumn.HeaderText = "Vrijednost";
			this.uxVrijednostDataGridViewColumn.Name = "uxVrijednostDataGridViewColumn";
			this.uxVrijednostDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxVrijednostDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxVrijednostDataGridViewColumn.ReadOnly = false;		
			//
			// uxZbrojDataGridViewColumn
			//
			this.uxZbrojDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxZbrojDataGridViewColumn.DataPropertyName = "Zbroj";
			this.uxZbrojDataGridViewColumn.HeaderText = "Zbroj";
			this.uxZbrojDataGridViewColumn.Name = "uxZbrojDataGridViewColumn";
			this.uxZbrojDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxZbrojDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxZbrojDataGridViewColumn.ReadOnly = false;		
			//
			// uxIspravakDataGridViewColumn
			//
			this.uxIspravakDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIspravakDataGridViewColumn.DataPropertyName = "Ispravak";
			this.uxIspravakDataGridViewColumn.HeaderText = "Ispravak";
			this.uxIspravakDataGridViewColumn.Name = "uxIspravakDataGridViewColumn";
			this.uxIspravakDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIspravakDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIspravakDataGridViewColumn.ReadOnly = false;		
			//
			// uxAmVrijednostDataGridViewColumn
			//
			this.uxAmVrijednostDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxAmVrijednostDataGridViewColumn.DataPropertyName = "AmVrijednost";
			this.uxAmVrijednostDataGridViewColumn.HeaderText = "AmVrijednost";
			this.uxAmVrijednostDataGridViewColumn.Name = "uxAmVrijednostDataGridViewColumn";
			this.uxAmVrijednostDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxAmVrijednostDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxAmVrijednostDataGridViewColumn.ReadOnly = false;		
			//
			// uxKnjizVrijednostDataGridViewColumn
			//
			this.uxKnjizVrijednostDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKnjizVrijednostDataGridViewColumn.DataPropertyName = "KnjizVrijednost";
			this.uxKnjizVrijednostDataGridViewColumn.HeaderText = "KnjizVrijednost";
			this.uxKnjizVrijednostDataGridViewColumn.Name = "uxKnjizVrijednostDataGridViewColumn";
			this.uxKnjizVrijednostDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKnjizVrijednostDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKnjizVrijednostDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDUserCreatedDataGridViewColumn
			//
			this.uxIDUserCreatedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDUserCreatedDataGridViewColumn.DataPropertyName = "IDUserCreated";
			this.uxIDUserCreatedDataGridViewColumn.HeaderText = "IDUserCreated";
			this.uxIDUserCreatedDataGridViewColumn.Name = "uxIDUserCreatedDataGridViewColumn";
			this.uxIDUserCreatedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDUserCreatedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDUserCreatedDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumZapisaDataGridViewColumn
			//
			this.uxDatumZapisaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumZapisaDataGridViewColumn.DataPropertyName = "DatumZapisa";
			this.uxDatumZapisaDataGridViewColumn.HeaderText = "DatumZapisa";
			this.uxDatumZapisaDataGridViewColumn.Name = "uxDatumZapisaDataGridViewColumn";
			this.uxDatumZapisaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumZapisaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumZapisaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOrgJedDataGridViewColumn
			//				
			this.uxIDOrgJedDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDOrgJedDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOrgJedDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOrgJedDataGridViewColumn.DataSource = uxIDOrgJedBindingSource;				
				
			//
			// uxIDOSDataGridViewColumn
			//				
			this.uxIDOSDataGridViewColumn.DisplayMember = "IDParentOS";	
			this.uxIDOSDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOSDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOSDataGridViewColumn.DataSource = uxIDOSBindingSource;				
				
			//
			// uxIDOsobaDataGridViewColumn
			//				
			this.uxIDOsobaDataGridViewColumn.DisplayMember = "Ime";	
			this.uxIDOsobaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOsobaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOsobaDataGridViewColumn.DataSource = uxIDOsobaBindingSource;				
				
			//
			// uxIDTipRetkaDataGridViewColumn
			//				
			this.uxIDTipRetkaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDTipRetkaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDTipRetkaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDTipRetkaDataGridViewColumn.DataSource = uxIDTipRetkaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxOSKarticaDataGridView);
			this.Name = "OSKarticaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOrgJedBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOsobaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDTipRetkaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSKarticaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSKarticaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSKarticaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				OSKarticaDataGridViewEventArgs args = new OSKarticaDataGridViewEventArgs();
				args.OSKartica = _currentOSKartica;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class OSKarticaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.OSKartica	_OSKartica;
	
			/// <summary>
			/// the  Entities.OSKartica instance.
			/// </summary>
			public Entities.OSKartica OSKartica
			{
				get { return _OSKartica; }
				set { _OSKartica = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxOSKarticaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnOSKarticaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxOSKarticaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOSKarticaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOSKarticaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].ID;
						break;
					case "uxIDOSDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].IDOS;
						break;
					case "uxDatumDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].Datum;
						break;
					case "uxKolicinaDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].Kolicina;
						break;
					case "uxIDTipRetkaDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].IDTipRetka;
						break;
					case "uxIDOrgJedDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].IDOrgJed;
						break;
					case "uxIDOsobaDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].IDOsoba;
						break;
					case "uxNapomenaDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].Napomena;
						break;
					case "uxIDStatusDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].IDStatus;
						break;
					case "uxNabVrDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].NabVr;
						break;
					case "uxVrijednostDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].Vrijednost;
						break;
					case "uxZbrojDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].Zbroj;
						break;
					case "uxIspravakDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].Ispravak;
						break;
					case "uxAmVrijednostDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].AmVrijednost;
						break;
					case "uxKnjizVrijednostDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].KnjizVrijednost;
						break;
					case "uxIDUserCreatedDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].IDUserCreated;
						break;
					case "uxDatumZapisaDataGridViewColumn":
						e.Value = OSKarticaList[e.RowIndex].DatumZapisa;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxOSKarticaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOSKarticaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOSKarticaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						OSKarticaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxIDOSDataGridViewColumn":
						OSKarticaList[e.RowIndex].IDOS = (System.Int32)e.Value;
						break;
					case "uxDatumDataGridViewColumn":
						OSKarticaList[e.RowIndex].Datum = (System.DateTime)e.Value;
						break;
					case "uxKolicinaDataGridViewColumn":
						OSKarticaList[e.RowIndex].Kolicina = (System.Decimal)e.Value;
						break;
					case "uxIDTipRetkaDataGridViewColumn":
						OSKarticaList[e.RowIndex].IDTipRetka = (System.Int32)e.Value;
						break;
					case "uxIDOrgJedDataGridViewColumn":
						OSKarticaList[e.RowIndex].IDOrgJed = (System.Int32)e.Value;
						break;
					case "uxIDOsobaDataGridViewColumn":
						OSKarticaList[e.RowIndex].IDOsoba = (System.Int32)e.Value;
						break;
					case "uxNapomenaDataGridViewColumn":
						OSKarticaList[e.RowIndex].Napomena = (System.String)e.Value;
						break;
					case "uxIDStatusDataGridViewColumn":
						OSKarticaList[e.RowIndex].IDStatus = (System.Int32)e.Value;
						break;
					case "uxNabVrDataGridViewColumn":
						OSKarticaList[e.RowIndex].NabVr = (System.Decimal)e.Value;
						break;
					case "uxVrijednostDataGridViewColumn":
						OSKarticaList[e.RowIndex].Vrijednost = (System.Decimal)e.Value;
						break;
					case "uxZbrojDataGridViewColumn":
						OSKarticaList[e.RowIndex].Zbroj = (System.Decimal)e.Value;
						break;
					case "uxIspravakDataGridViewColumn":
						OSKarticaList[e.RowIndex].Ispravak = (System.Decimal)e.Value;
						break;
					case "uxAmVrijednostDataGridViewColumn":
						OSKarticaList[e.RowIndex].AmVrijednost = (System.Decimal)e.Value;
						break;
					case "uxKnjizVrijednostDataGridViewColumn":
						OSKarticaList[e.RowIndex].KnjizVrijednost = (System.Decimal)e.Value;
						break;
					case "uxIDUserCreatedDataGridViewColumn":
						OSKarticaList[e.RowIndex].IDUserCreated = (System.Int32?)e.Value;
						break;
					case "uxDatumZapisaDataGridViewColumn":
						OSKarticaList[e.RowIndex].DatumZapisa = (System.DateTime?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
